package com.greydawn.CompositePattern;

/**
 * @Author: zhongwr
 * @Create: 2021/12/19 17:00
 * @Version 1.0
 * @Description:
 */
public class Leaf extends Component {

    public Leaf(String name) {
        this.name = name;
    }

    @Override
    public void add(Component component) {
        System.out.println("叶子没有分支");
    }

    @Override
    public void remove(Component component) {
        System.out.println("叶子没有分支");
    }

    @Override
    public void display() {
        System.out.println("----" + this.name);
    }
}
